﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Laba1
{
   public class Subject
   {
       private string _name;
       private List<StudentCard> _students = new List<StudentCard>();
       private List<PracticalTask> _practicalTasks = new List<PracticalTask>();
       private List<BoundaryControl> _boundaryControls = new List<BoundaryControl>();
       private FinalControl _finalControl;
     //  private bool _isExam;
       private List<Evaluation> _evaluations;

       public Subject(string name, List<Evaluation> evaluations)
       {
           _name = name;
           _evaluations = evaluations;
       }

      /* public Subject(string name, bool isExam)
       {
           _name = name;
           _isExam = isExam;
           _evaluations=new List<Evaluation>();
           
           if(isExam)
           {
               setEvaluationsForExam(60,71,85);
           }
           else
           {
               setEvaluationsForSetoff(65);
           }

       }*/

       public void AddStudent(string name)
       {
           _students.Add(new StudentCard(name, this));
       }

       public void AddPracticalTask(int maximumRating, int passingRating, string name, DateTime deadline, PrincipleOfRatingByDate principleOfRatingByDate)
       {
           _practicalTasks.Add(new PracticalTask(maximumRating, passingRating, name, deadline, principleOfRatingByDate));
       }

       public void AddBoundaryControl(string name, int passingRating, int maximumRating, DateTime date)
       {
           _boundaryControls.Add(new BoundaryControl(name,passingRating,maximumRating,date));
       }

       public void SetFinalControl(string name, int passingRating, int maximumRating)
       {
           _finalControl=new FinalControl(name,passingRating,maximumRating);
       }

       public List<PracticalTask> PracticalTasks
       {
           get { return _practicalTasks; }
       }

       public List<BoundaryControl> BoundaryControls
       {
           get { return _boundaryControls; }
       }

       public FinalControl FinalControl
       {
           get { return _finalControl; }
       }

       public List<StudentCard> Students
       {
           get { return _students; }
       }

   /*    public void setEvaluationsForExam(int minimumForSatisfactory, int minimumForGood, int minimumForExcellent)
       {
           _evaluations.Add(new Evaluation(0,minimumForSatisfactory-1,"неуд"));
           _evaluations.Add(new Evaluation(minimumForSatisfactory, minimumForGood-1,"удовл"));
           _evaluations.Add(new Evaluation(minimumForGood, minimumForExcellent-1,"хор"));
           _evaluations.Add(new Evaluation(minimumForExcellent,100,"отл"));
       }

       public void setEvaluationsForSetoff(int minimumForSetoff)
       {
           _evaluations.Add(new Evaluation(0, minimumForSetoff-1,"незачет"));
           _evaluations.Add(new Evaluation(minimumForSetoff, 100, "зачет"));
       }
       */
       public string getEvaluation(int rating)
       {
           foreach (var evaluation in _evaluations)
           {
               if (evaluation.isEvaluation(rating)) return evaluation.Evaluation1;
           }
           return null;
       }

       public List<Evaluation> Evaluations
       {
           get { return _evaluations; }
           set { _evaluations = value; }
       }
   }
}
